#!/usr/bin/env python
# -*- encoding: utf-8 -*-

import sys, datetime
import pandas as pd
import numpy as np
import xlsxwriter
# from scipy.optimize import minimize
# from scipy.optimize import Bounds
# import scipy.optimize as opt



from xpy3lib.XRetryableQuery import XRetryableQuery
from xpy3lib.XRetryableSave import XRetryableSave
from sicost.AbstractDPJob import AbstractDPJob


class MODELJob(AbstractDPJob):


    def __init__(self,
                 p_config=None,
                 p_db_conn_mpp=None,
                 p_db_conn_rds=None,
                 p_db_conn_dbprod7=None):


        super(MODELJob, self).__init__(p_config=p_config,
                                        p_db_conn_mpp=p_db_conn_mpp,
                                        p_db_conn_rds=p_db_conn_rds,
                                        p_db_conn_dbprod7=p_db_conn_dbprod7,
                                        p_unit=None,
                                        p_account=None,
                                        p_cost_center=None,
                                        p_account_period_start=None,
                                        p_account_period_end=None)

        pass

    def do_execute(self):
        #铁水温度成分停吹温度影响 sheet1
        #发热剂对石灰及铁损影响 sheet2
        #矿石用量影响 sheet3
        #铁水废钢价格影响 sheet4
        #过程数据汇总 sheet5
        #各种价格及参数输入画面 sheet6
        #计算总结果 sheet7


        #sheet6 C3-C12 delete
        #sheet6 D6 取新EXCEL D14 3278
        #铁水价格暂人工输入  E17
        #废钢价格  采购表？ 采购系统人工输入？
        #D5678 铁矿石上月实际块矿 D8财务预算当月预算人工输入？
        #B20 B21 财务 铁水量
        #B25手工输入
        #SH4 B6 用9月铁钢excel B14
        #B7固定 C10 D10写死

        #type = 1时，根据铁水，钢水，通过公式计算当前铁水比，再与基准铁水比进行比较盈亏
        #type = 2时，根据铁水，钢水，计算最优铁水比
        #type = 3时，根据铁水，钢水，通过公式计算当前铁水比，当增加一定量的铁水（1）时，如何分配给一炼钢二炼钢各多少时最优
        type = 3
        #code = 0
        if type == 2:
            # degree = 0.001
            # act_degree = 0.001 / degree
            min_result = 100
            for sheet7_B6_R in range(810, 836, 1):
                sheet7_B6 = sheet7_B6_R / 1000
                # print(result)
                for sheet7_C6_R in range(840, 866, 1):
                    sheet7_C6 = sheet7_C6_R / 1000
                    sheet6_J20 = 58.87
                    sheet6_J21 = 53.04
                    sheet7_B4 = sheet6_J20
                    sheet7_C4 = sheet6_J21

                    sheet7_B7 = 63.58
                    sheet7_C7 = 55.94
                    sheet6_F20 = 0.966863
                    sheet6_F21 = 0.968649
                    sheet7_B9 = sheet6_F20
                    sheet7_C9 = sheet6_F21
                    sheet7_B8 = sheet7_B7 / sheet7_B9
                    sheet7_C8 = sheet7_C7 / sheet7_C9
                    sheet6_E20 = 1078.56
                    sheet6_E21 = 1068.90
                    code = 0
                    sheet7_D13 = self.__step_S7D13(sheet7_B6=sheet7_B6, sheet7_C6=sheet7_C6, sheet7_B8=sheet7_B8, sheet7_C8=sheet7_C8, sheet7_B4=sheet7_B4, sheet7_C4=sheet7_C4
                                                   , sheet6_J20=sheet6_J20, sheet6_J21=sheet6_J21, sheet7_B7=sheet7_B7, sheet7_C7=sheet7_C7,
                                                   sheet6_F20=sheet6_F20, sheet6_F21=sheet6_F21, sheet7_B9=sheet7_B9, sheet7_C9=sheet7_C9,
                                                   sheet6_E20=sheet6_E20, sheet6_E21=sheet6_E21, code=code)




                    result = sheet7_D13
                    if result < min_result:
                        min_result = result
                        best_B6 = sheet7_B6
                        best_C6 = sheet7_C6

            print(min_result)
            print(best_B6)
            print(best_C6)
            sheet7_B6 = best_B6
            sheet7_C6 = best_C6
            sheet6_J20 = 58.87
            sheet6_J21 = 53.04
            sheet7_B4 = sheet6_J20
            sheet7_C4 = sheet6_J21

            sheet7_B7 = 63.58
            sheet7_C7 = 55.94
            sheet6_F20 = 0.966863
            sheet6_F21 = 0.968649
            sheet7_B9 = sheet6_F20
            sheet7_C9 = sheet6_F21
            sheet7_B8 = sheet7_B7 / sheet7_B9
            sheet7_C8 = sheet7_C7 / sheet7_C9
            sheet6_E20 = 1078.56
            sheet6_E21 = 1068.90
            code = 1
            sheet7_D13 = self.__step_S7D13(sheet7_B6=sheet7_B6, sheet7_C6=sheet7_C6, sheet7_B8=sheet7_B8,
                                           sheet7_C8=sheet7_C8, sheet7_B4=sheet7_B4, sheet7_C4=sheet7_C4
                                           , sheet6_J20=sheet6_J20, sheet6_J21=sheet6_J21, sheet7_B7=sheet7_B7,
                                           sheet7_C7=sheet7_C7,
                                           sheet6_F20=sheet6_F20, sheet6_F21=sheet6_F21, sheet7_B9=sheet7_B9,
                                           sheet7_C9=sheet7_C9,
                                           sheet6_E20=sheet6_E20, sheet6_E21=sheet6_E21, code=code)






        if type == 3:
            ADD_IRON = 1
            degree = 1000
            min_result = 100
            # sheet7_B6_max = 0.835
            # sheet7_B6_min = 0.810
            # sheet7_C6_max = 0.865
            # sheet7_C6_min = 0.840
            #
            # sheet6_J20 = 58.87
            # sheet6_J21 = 53.04
            # sheet7_B4 = sheet6_J20
            # sheet7_C4 = sheet6_J21
            #
            # sheet7_B7 = 63.58
            # sheet7_C7 = 55.94
            # sheet6_F20 = 0.966863
            # sheet6_F21 = 0.968649
            # sheet7_B9 = sheet6_F20
            # sheet7_C9 = sheet6_F21
            # sheet7_B8 = sheet7_B7 / sheet7_B9
            # sheet7_C8 = sheet7_C7 / sheet7_C9
            # sheet6_E20 = 1078.56
            # sheet6_E21 = 1068.90
            # sheet7_B4_max = (sheet7_B8 * sheet6_E20 / 1000) * sheet7_B6_max
            # sheet7_C4_max = (sheet7_C8 * sheet6_E21 / 1000) * sheet7_C6_max
            # sheet7_B4_min = (sheet7_B8 * sheet6_E20 / 1000) * sheet7_B6_min
            # sheet7_C4_min = (sheet7_C8 * sheet6_E21 / 1000) * sheet7_C6_min
            #
            # ADD_B4_max = sheet7_B4_max - sheet7_B4
            # ADD_B4_min = sheet7_B4_min - sheet7_B4
            # ADD_C4_max = sheet7_C4_max - sheet7_C4
            # ADD_C4_min = sheet7_C4_min - sheet7_C4




            for sheet7_B4_ADD_R in range(0, ADD_IRON*degree+1, 1):
                sheet7_B4_ADD = sheet7_B4_ADD_R / degree
                sheet7_C4_ADD = (ADD_IRON*degree - sheet7_B4_ADD_R) / degree
                # sheet7_C4_ADD = 1 - sheet7_B4_ADD

                sheet6_J20 = 58.87
                sheet6_J21 = 53.04
                sheet7_B4 = sheet6_J20
                sheet7_C4 = sheet6_J21

                sheet7_B4 = sheet7_B4 + sheet7_B4_ADD
                sheet7_C4 = sheet7_C4 + sheet7_C4_ADD

                sheet7_B7 = 63.58
                sheet7_C7 = 55.94
                sheet6_F20 = 0.966863
                sheet6_F21 = 0.968649
                sheet7_B9 = sheet6_F20
                sheet7_C9 = sheet6_F21
                sheet7_B8 = sheet7_B7 / sheet7_B9
                sheet7_C8 = sheet7_C7 / sheet7_C9
                sheet6_E20 = 1078.56
                sheet6_E21 = 1068.90


                # 根据铁水比公式得到的铁水比
                sheet7_B6 = sheet7_B4 / (sheet7_B8 * sheet6_E20 / 1000)
                sheet7_C6 = sheet7_C4 / (sheet7_C8 * sheet6_E21 / 1000)
                code = 0
                sheet7_D13 = self.__step_S7D13(sheet7_B6=sheet7_B6, sheet7_C6=sheet7_C6, sheet7_B8=sheet7_B8,
                                               sheet7_C8=sheet7_C8, sheet7_B4=sheet7_B4, sheet7_C4=sheet7_C4
                                               , sheet6_J20=sheet6_J20, sheet6_J21=sheet6_J21, sheet7_B7=sheet7_B7,
                                               sheet7_C7=sheet7_C7, sheet6_F20=sheet6_F20, sheet6_F21=sheet6_F21,
                                               sheet7_B9=sheet7_B9, sheet7_C9=sheet7_C9, sheet6_E20=sheet6_E20, sheet6_E21=sheet6_E21, code=code)


                result = sheet7_D13
                if result < min_result:
                    min_result = result
                    best_B4_ADD = sheet7_B4_ADD
                    best_C4_ADD = sheet7_C4_ADD

            print(min_result)
            print(best_B4_ADD)
            print(best_C4_ADD)

            sheet6_J20 = 58.87
            sheet6_J21 = 53.04
            sheet7_B4 = sheet6_J20
            sheet7_C4 = sheet6_J21

            sheet7_B4 = sheet7_B4 + best_B4_ADD
            sheet7_C4 = sheet7_C4 + best_C4_ADD

            sheet7_B7 = 63.58
            sheet7_C7 = 55.94
            sheet6_F20 = 0.966863
            sheet6_F21 = 0.968649
            sheet7_B9 = sheet6_F20
            sheet7_C9 = sheet6_F21
            sheet7_B8 = sheet7_B7 / sheet7_B9
            sheet7_C8 = sheet7_C7 / sheet7_C9
            sheet6_E20 = 1078.56
            sheet6_E21 = 1068.90

            # 根据铁水比公式得到的铁水比
            sheet7_B6 = sheet7_B4 / (sheet7_B8 * sheet6_E20 / 1000)
            sheet7_C6 = sheet7_C4 / (sheet7_C8 * sheet6_E21 / 1000)
            code = 1
            sheet7_D13 = self.__step_S7D13(sheet7_B6=sheet7_B6, sheet7_C6=sheet7_C6, sheet7_B8=sheet7_B8,
                                           sheet7_C8=sheet7_C8, sheet7_B4=sheet7_B4, sheet7_C4=sheet7_C4
                                           , sheet6_J20=sheet6_J20, sheet6_J21=sheet6_J21, sheet7_B7=sheet7_B7,
                                           sheet7_C7=sheet7_C7,
                                           sheet6_F20=sheet6_F20, sheet6_F21=sheet6_F21, sheet7_B9=sheet7_B9,
                                           sheet7_C9=sheet7_C9,
                                           sheet6_E20=sheet6_E20, sheet6_E21=sheet6_E21, code=code)




        if type == 1:
            sheet6_J20 = 58.87
            sheet6_J21 = 53.04
            sheet7_B4 = sheet6_J20
            sheet7_C4 = sheet6_J21

            sheet7_B7 = 63.58
            sheet7_C7 = 55.94
            sheet6_F20 = 0.966863
            sheet6_F21 = 0.968649
            sheet7_B9 = sheet6_F20
            sheet7_C9 = sheet6_F21
            sheet7_B8 = sheet7_B7 / sheet7_B9
            sheet7_C8 = sheet7_C7 / sheet7_C9
            sheet6_E20 = 1078.56
            sheet6_E21 = 1068.90

            # 基准值
            # sheet7_B6 = 0.8301
            # sheet7_C6 = 0.8593
            # 随机输入的两个铁水比参数
            # sheet7_B6 = 0.82
            # sheet7_C6 = 0.86
            # 根据铁水比公式得到的铁水比
            sheet7_B6 = sheet7_B4 / (sheet7_B8 * sheet6_E20 / 1000)
            sheet7_C6 = sheet7_C4 / (sheet7_C8 * sheet6_E21 / 1000)

            code = 1
            sheet7_D13 = self.__step_S7D13(sheet7_B6=sheet7_B6, sheet7_C6=sheet7_C6, sheet7_B8=sheet7_B8,
                                           sheet7_C8=sheet7_C8, sheet7_B4=sheet7_B4, sheet7_C4=sheet7_C4
                                           , sheet6_J20=sheet6_J20, sheet6_J21=sheet6_J21, sheet7_B7=sheet7_B7,
                                           sheet7_C7=sheet7_C7, sheet6_F20=sheet6_F20, sheet6_F21=sheet6_F21,
                                           sheet7_B9=sheet7_B9, sheet7_C9=sheet7_C9, sheet6_E20=sheet6_E20,
                                           sheet6_E21=sheet6_E21, code=code)






        super(MODELJob, self).do_execute()

    def __step_S7D13(self, sheet7_B6=None, sheet7_C6=None, sheet7_B8=None, sheet7_C8=None, sheet7_B4=None,
                     sheet7_C4=None, sheet6_J20=None, sheet6_J21=None, sheet7_B7=None, sheet7_C7=None,
                     sheet6_F20=None, sheet6_F21=None, sheet7_B9=None, sheet7_C9=None,sheet6_E20=None, sheet6_E21=None
                     ,code=None):



        # 基准值
        # sheet7_B6 = 0.8301
        # sheet7_C6 = 0.8593
        # 随机输入的两个铁水比参数
        # sheet7_B6 = 0.82
        # sheet7_C6 = 0.86
        # 根据铁水比公式得到的铁水比
        # sheet7_B6 = sheet7_B4 / (sheet7_B8 * sheet6_E20 / 1000)
        # sheet7_C6 = sheet7_C4 / (sheet7_C8 * sheet6_E21 / 1000)

        # sheet6_B16 = 62.8
        # sheet6_D11 = 1253.6
        # sheet6_D6 = 3280
        sheet4_B6 = 0.935
        # sheet6_B35 = 3
        # sheet6_C16 = 3.5
        # sheet6_D5 = 508.5
        # sheet6_F20 = 0.966863
        # sheet6_F21 = 0.968649

        # 各种价格及参数输入画面 sheet6
        sheet6_C5 = 2011.842
        sheet6_C6 = 2190.4
        sheet6_C9 = 509
        sheet6_C10 = 2000
        sheet6_C11 = 703
        sheet6_C12 = 2170.08473641534
        sheet6_D5 = 3710
        sheet6_D6 = 3280
        sheet6_D9 = 508.5
        sheet6_D10 = 2000
        sheet6_D11 = 1253.6
        sheet6_D12 = 2992.78307679633

        sheet6_B16 = 62.8
        sheet6_C16 = 3.5

        sheet6_B20 = sheet6_J20 / 10000
        sheet6_B21 = sheet6_J21 / 10000
        sheet6_C20 = sheet6_B20 / (sheet6_B20 + sheet6_B21)
        sheet6_C21 = sheet6_B21 / (sheet6_B20 + sheet6_B21)
        sheet6_D20 = 0.8301
        sheet6_D21 = 0.8593

        sheet6_B25 = 0.4005
        sheet6_B26 = 0.4174
        sheet6_C25 = 1349.9
        sheet6_C26 = 1347.2

        sheet6_C30 = 1652.9
        sheet6_C31 = 1661.7

        sheet6_B35 = 3
        sheet6_B36 = 3
        sheet6_C35 = 0.2175
        sheet6_C36 = 0.1777

        # 铁水温度成分停吹温度影响 sheet1
        # 铁水温度的影响 sheet1 table1
        # 一炼钢标准温度
        sheet1_B4 = 1349.9
        # 二炼钢标准温度
        sheet1_C4 = 1347.2
        # 预计温度
        sheet1_B5 = sheet6_C25
        sheet1_C5 = sheet6_C26
        # 温度差值
        # MIN为 -25℃？
        sheet1_B6 = sheet1_B5 - sheet1_B4
        sheet1_C6 = sheet1_C5 - sheet1_C4
        # 折算冷却能
        sheet1_B7 = 0.4 * sheet1_B6 / 10
        sheet1_C7 = 0.4 * sheet1_C6 / 10

        # 铁水Si的影响 sheet1 table2
        # 一炼钢标准Si
        sheet1_G4 = 0.4005
        # 二炼钢标准Si
        sheet1_H4 = 0.4174
        # 预计Si
        sheet1_G5 = sheet6_B25
        sheet1_H5 = sheet6_B26
        # Si差值
        # MIN？
        sheet1_G6 = sheet1_G5 - sheet1_G4
        sheet1_H6 = sheet1_H5 - sheet1_H4
        # 折算冷却能
        sheet1_G7 = 1.3 * sheet1_G6 * 10
        sheet1_H7 = 1.3 * sheet1_H6 * 10
        # 停吹温度的影响 sheet1 table3
        # 一炼钢标准T
        sheet1_L4 = 1652.9
        # 二炼钢标准T
        sheet1_M4 = 1661.7
        # 预计T
        sheet1_L5 = sheet6_C30
        sheet1_M5 = sheet6_C31
        # T差值
        # MIN？
        # 4-5?
        sheet1_L6 = sheet1_L4 - sheet1_L5
        sheet1_M6 = sheet1_M4 - sheet1_M5
        # 折算冷却能
        sheet1_L7 = 0.6 * sheet1_L6 / 10
        sheet1_M7 = 0.6 * sheet1_M6 / 10
        # 发热剂对石灰及铁损影响 sheet2
        # 加发热剂对钢铁料消耗的影响 sheet2 table1
        sheet2_C3 = 0.18
        sheet2_C4 = 0.18
        sheet2_D3 = 700
        sheet2_D4 = 700
        sheet2_E3 = sheet2_D3 * sheet2_C3 * 60 / 28
        sheet2_E4 = sheet2_D4 * sheet2_C4 * 60 / 28
        sheet2_F3 = 3
        sheet2_F4 = 3
        sheet2_G3 = sheet2_F3 * sheet2_E3 + sheet2_E3
        sheet2_G4 = sheet2_F4 * sheet2_E4 + sheet2_E4
        sheet2_H3 = sheet2_D3 * 0.10 * sheet2_F3 * 0.8
        sheet2_H4 = sheet2_D4 * 0.10 * sheet2_F4 * 0.8
        sheet2_I3 = sheet2_G3 + sheet2_H3
        sheet2_I4 = sheet2_G4 + sheet2_H4
        sheet2_J3 = sheet6_C35
        sheet2_J4 = sheet6_C36
        sheet2_K3 = sheet2_I3 * sheet2_J3
        sheet2_K4 = sheet2_I4 * sheet2_J4
        sheet2_L3 = sheet2_K3 / 300 * 0.9
        sheet2_L4 = sheet2_K4 / 300 * 0.9
        sheet2_M3 = sheet2_E3 * sheet2_F3 / 0.91 / 300
        sheet2_M4 = sheet2_E4 * sheet2_F4 / 0.91 / 300
        sheet2_N3 = sheet6_D12 * sheet2_L3 / 1000
        sheet2_N4 = sheet6_D12 * sheet2_L4 / 1000
        sheet2_O3 = sheet6_D9 * sheet2_M3 / 1000
        sheet2_O4 = sheet6_D9 * sheet2_M4 / 1000
        sheet2_P3 = sheet6_D10 * sheet2_D3 / 1000 / 300
        sheet2_P4 = sheet6_D10 * sheet2_D4 / 1000 / 300
        sheet2_Q3 = sheet2_N3 + sheet2_O3 + sheet2_P3
        sheet2_Q4 = sheet2_N4 + sheet2_O4 + sheet2_P4
        # 如转炉热量不足比较多，而铁水条件的波动未及时反映出来，可能造成发热剂加入量不够，吹炼后期需要依靠铁的氧化来升温，渣中（T.Fe）含量可能从正常值增加到28%，钢铁料消耗增加如下表。

        # 转炉热量不平衡引起的过吹造成的损失（单炉） sheet2 table2
        sheet2_B9 = sheet6_C35
        sheet2_B10 = sheet6_C36
        sheet2_C9 = 0.28
        sheet2_C10 = 0.25
        sheet2_D9 = (sheet2_C9 - sheet2_B9) * 29 * 1000 / 300
        sheet2_D10 = (sheet2_C10 - sheet2_B10) * 29 * 1000 / 300
        # 备注：炉渣量29吨/炉
        # 备注：潜在隐形成本未考虑，随着发热剂硅元素增加，喷溅加大，增加环保和钢铁料消耗成本增加。

        # 一炼钢系数 sheet2 table3
        # sheet2_A17_max = 0.87
        # sheet2_A17_min = 0.86
        # sheet2_A18_max = 0.86
        # sheet2_A18_min = 0.85
        # sheet2_A19_max = 0.85
        # sheet2_A19_min = 0.84
        # sheet2_A20_max = 0.84
        # sheet2_A20_min = 0.83
        # sheet2_A21_max = 0.83
        # sheet2_A21_min = 0.82
        # sheet2_A22_max = 0.82
        # sheet2_A22_min = 0.81
        sheet2_B17 = 0.15
        sheet2_B18 = 0.30
        sheet2_B19 = 0.40
        sheet2_B20 = 0.50
        sheet2_B21 = 0.70
        sheet2_B22 = 1.00
        sheet2_C17 = sheet2_B17 + 0.93
        sheet2_C18 = sheet2_C17 + sheet2_B18
        sheet2_C19 = sheet2_C18 + sheet2_B19
        sheet2_C20 = sheet2_C19 + sheet2_B20
        sheet2_C21 = sheet2_C20 + sheet2_B21
        sheet2_C22 = sheet2_C21 + sheet2_B22
        sheet2_D17 = 0.010
        sheet2_D18 = 0.010
        sheet2_D19 = 0.010
        sheet2_D20 = 0.010
        sheet2_D21 = 0.025
        sheet2_D22 = 0.035
        sheet2_F16 = 87
        sheet2_F17 = sheet7_B6 * 100 + 1.94 + sheet1_B7 + sheet1_G7 + sheet1_L7
        sheet2_F18 = sheet2_F16 - sheet2_F17
        if sheet2_F18 > 2 and sheet2_F18 <= 3:
            sheet2_F20 = sheet2_B19 * (sheet2_F18 - 2.05)
        elif sheet2_F18 > 3 and sheet2_F18 <= 4:
            sheet2_F20 = sheet2_C19 - sheet2_C18 - sheet2_B19 * 0.05 + sheet2_B20 * (sheet2_F18 - 3)
        elif sheet2_F18 > 4 and sheet2_F18 <= 5:
            sheet2_F20 = sheet2_C20 - sheet2_C18 - sheet2_B19 * 0.05 + sheet2_B21 * (sheet2_F18 - 4)
        elif sheet2_F18 > 5 and sheet2_F18 <= 10:
            sheet2_F20 = sheet2_C21 - sheet2_C18 - sheet2_B19 * 0.05 + sheet2_B22 * (sheet2_F18 - 5)
        elif sheet2_F18 > 1 and sheet2_F18 <= 2:
            sheet2_F20 = -sheet2_B19 * 0.05 + sheet2_B18 * (sheet2_F18 - 2)
        elif sheet2_F18 > 0 and sheet2_F18 <= 1:
            sheet2_F20 = -sheet2_B19 * 0.05 - sheet2_B18 + sheet2_B17 * (sheet2_F18 - 1)
        elif sheet2_F18 <= 0:
            sheet2_F20 = -sheet2_B19 * 0.05 - sheet2_B18 - sheet2_B17

        # 铁水比变化加硅铁碳球对吹炼铁损和石灰消耗的影响 sheet2 table4
        sheet2_I19 = sheet2_L3 * sheet2_F20
        sheet2_J19 = sheet2_M3 * sheet2_F20
        sheet2_K19 = sheet2_D3 * sheet2_F20 / 300
        sheet2_I20 = sheet6_D12 * sheet2_I19 / 1000
        sheet2_J20 = sheet6_D9 * sheet2_J19 / 1000
        sheet2_K20 = sheet6_D10 * sheet2_K19 / 1000
        sheet2_L20 = sheet2_I20 + sheet2_J20 + sheet2_K20

        # 二炼钢系数 sheet2 table5
        # sheet2_A26_max = 0.90
        # sheet2_A26_min = 0.89
        # sheet2_A27_max = 0.89
        # sheet2_A27_min = 0.88
        # sheet2_A28_max = 0.88
        # sheet2_A28_min = 0.87
        # sheet2_A29_max = 0.87
        # sheet2_A29_min = 0.86
        # sheet2_A30_max = 0.86
        # sheet2_A30_min = 0.85
        # sheet2_A31_max = 0.85
        # sheet2_A31_min = 0.84
        sheet2_B26 = 0.15
        sheet2_B27 = 0.30
        sheet2_B28 = 0.45
        sheet2_B29 = 0.60
        sheet2_B30 = 0.80
        sheet2_B31 = 1.00
        sheet2_C26 = sheet2_B26 + 0.4
        sheet2_C27 = sheet2_C26 + sheet2_B27
        sheet2_C28 = sheet2_C27 + sheet2_B28
        sheet2_C29 = sheet2_C28 + sheet2_B29
        sheet2_C30 = sheet2_C29 + sheet2_B30
        sheet2_C31 = sheet2_C30 + sheet2_B31
        sheet2_D26 = 0.010
        sheet2_D27 = 0.010
        sheet2_D28 = 0.010
        sheet2_D29 = 0.010
        sheet2_D30 = 0.025
        sheet2_D31 = 0.035
        sheet2_F25 = 90
        sheet2_F26 = sheet7_C6 * 100 + 1.59 + sheet1_C7 + sheet1_H7 + sheet1_M7
        sheet2_F27 = sheet2_F25 - sheet2_F26
        if sheet2_F27 > 2 and sheet2_F27 <= 3:
            sheet2_F29 = sheet2_B28 * (sheet2_F27 - 2.48)
        elif sheet2_F27 > 3 and sheet2_F27 <= 4:
            sheet2_F29 = sheet2_C28 - sheet2_C27 - sheet2_B28 * 0.48 + sheet2_B29 * (sheet2_F27 - 3)
        elif sheet2_F27 > 4 and sheet2_F27 <= 5:
            sheet2_F29 = sheet2_C29 - sheet2_C27 - sheet2_B28 * 0.48 + sheet2_B30 * (sheet2_F27 - 4)
        elif sheet2_F27 > 5 and sheet2_F27 <= 10:
            sheet2_F29 = sheet2_C30 - sheet2_C27 - sheet2_B28 * 0.48 + sheet2_B31 * (sheet2_F27 - 5)
        elif sheet2_F27 > 1 and sheet2_F27 <= 2:
            sheet2_F29 = -sheet2_B28 * 0.48 + sheet2_B27 * (sheet2_F27 - 2)
        elif sheet2_F27 > 0 and sheet2_F27 <= 1:
            sheet2_F29 = -sheet2_B28 * 0.48 - sheet2_B27 + sheet2_B27 * (sheet2_F27 - 1)
        elif sheet2_F27 <= 0:
            sheet2_F29 = -sheet2_B28 * 0.48 - sheet2_B27 - sheet2_B26

        # 铁水比变化加硅铁碳球对吹炼铁损和石灰消耗的影响 sheet2 table6

        sheet2_I28 = sheet2_L4 * sheet2_F29
        sheet2_J28 = sheet2_M4 * sheet2_F29
        sheet2_K28 = sheet2_D4 * sheet2_F29 / 300
        sheet2_I29 = sheet6_D12 * sheet2_I28 / 1000
        sheet2_J29 = sheet6_D9 * sheet2_J28 / 1000
        sheet2_K29 = sheet6_D10 * sheet2_K28 / 1000
        sheet2_L29 = sheet2_I29 + sheet2_J29 + sheet2_K29

        # 炉次过吹造成铁损 sheet2 table7

        sheet2_B34 = 87
        sheet2_C34 = 90
        sheet2_B35 = sheet2_F17
        sheet2_C35 = sheet2_F26
        sheet2_B36 = sheet2_B34 - sheet2_B35
        sheet2_C36 = sheet2_C34 - sheet2_C35
        if sheet2_B36 > 2 and sheet2_B36 <= 3:
            sheet2_B37 = sheet2_D19 * (sheet2_B36 - 2.05)
        elif sheet2_B36 > 3 and sheet2_B36 <= 4:
            sheet2_B37 = sheet2_D19 * 0.95 + sheet2_D20 * (sheet2_B36 - 3)
        elif sheet2_B36 > 4 and sheet2_B36 <= 5:
            sheet2_B37 = sheet2_D19 * 0.95 + sheet2_D20 + sheet2_D21 * (sheet2_B36 - 4)
        elif sheet2_B36 > 5 and sheet2_B36 <= 10:
            sheet2_B37 = sheet2_D19 * 0.95 + sheet2_D20 + sheet2_D21 + sheet2_D22 * (sheet2_B36 - 5)
        elif sheet2_B36 > 1 and sheet2_B36 <= 2:
            sheet2_B37 = -sheet2_D19 * 0.05 + sheet2_D18 * (sheet2_B36 - 2)
        elif sheet2_B36 > 0 and sheet2_B36 <= 1:
            sheet2_B37 = -sheet2_D19 * 0.05 - sheet2_D18 + sheet2_D17 * (sheet2_B36 - 1)
        elif sheet2_B36 <= 0:
            sheet2_B37 = -sheet2_D19 * 0.05 - sheet2_D18 - sheet2_D17

        if sheet2_C36 > 2 and sheet2_C36 <= 3:
            sheet2_C37 = sheet2_D28 * (sheet2_C36 - 2.48)
        elif sheet2_C36 > 3 and sheet2_C36 <= 4:
            sheet2_C37 = sheet2_D28 * 0.52 + sheet2_D29 * (sheet2_C36 - 3)
        elif sheet2_C36 > 4 and sheet2_C36 <= 5:
            sheet2_C37 = sheet2_D28 * 0.52 + sheet2_D29 + sheet2_D30 * (sheet2_C36 - 4)
        elif sheet2_C36 > 5 and sheet2_C36 <= 10:
            sheet2_C37 = sheet2_D28 * 0.52 + sheet2_D29 + sheet2_D30 + sheet2_D31 * (sheet2_C36 - 5)
        elif sheet2_C36 > 1 and sheet2_C36 <= 2:
            sheet2_C37 = -sheet2_D28 * 0.48 + sheet2_D27 * (sheet2_C36 - 2)
        elif sheet2_C36 > 0 and sheet2_C36 <= 1:
            sheet2_C37 = -sheet2_D28 * 0.48 - sheet2_D27 + sheet2_D26 * (sheet2_C36 - 1)
        elif sheet2_C36 <= 0:
            sheet2_C37 = -sheet2_D28 * 0.48 - sheet2_D27 - sheet2_D26

        sheet2_B38 = sheet2_D9 * sheet2_B37 * sheet6_D12 / 300
        sheet2_C38 = sheet2_D10 * sheet2_C37 * sheet6_D12 / 300

        # 矿石用量影响 sheet3
        # 铁水比降低1%，转炉入炉原料热值减少，废钢用量增加，矿石投入减少 sheet3 table1
        sheet3_B3 = -320 / (3.3 * 100) / 300
        sheet3_B4 = -sheet3_B3 * sheet6_B16 / 100 * (1 - sheet6_C35) / sheet4_B6
        sheet3_C3 = sheet6_D11
        sheet3_C4 = sheet6_D6
        sheet3_D3 = sheet3_B3 * sheet3_C3
        sheet3_D4 = sheet3_B4 * sheet3_C4
        sheet3_D5 = sheet3_D3 + sheet3_D4
        # 备注：装入量按照320吨计算

        # sheet3 table2
        sheet3_C8 = 87
        sheet3_D8 = 90
        sheet3_C9 = sheet2_F17
        sheet3_D9 = sheet2_F26
        sheet3_C10 = sheet3_C8 - sheet3_C9
        sheet3_D10 = sheet3_D8 - sheet3_D9
        if sheet3_C10 >= 2.07:
            sheet3_C12 = 0
        elif sheet3_C10 < 2.07:
            sheet3_C12 = 0

        # 一、二炼钢分别以87%、90%铁水比为基准
        if sheet3_D10 > 2.48 and sheet3_D10 <= 3:
            sheet3_D12 = sheet3_D5 * (sheet3_D10 - 2.48)
        elif sheet3_D10 > 3:
            sheet3_D12 = sheet3_D5 * (3 - 2.48)
        elif sheet3_D10 <= 2.48:
            sheet3_D12 = 0

        # 一、二炼钢分别以制造部数据83.01%、85.93%铁水比为基准

        # 铁水比变化1%引起的矿石量变化对钢铁料消耗和石灰消耗的影响 sheet3 table3
        sheet3_A16 = 320 / (3.3 * 100) * 1000
        sheet3_B16 = sheet6_C16
        sheet3_C16 = sheet6_B35
        sheet3_D16 = sheet3_A16 * sheet3_B16 / 100 * (sheet3_C16 + 1)
        sheet3_E16 = sheet6_C35
        sheet3_F16 = sheet3_D16 * sheet3_E16
        sheet3_G16 = sheet3_A16 * sheet6_B16 / 100 * (1 - sheet3_E16)
        sheet3_H16 = -(sheet3_G16 - sheet3_F16) / 300
        sheet3_I16 = sheet3_A16 * sheet3_B16 / 100 * sheet3_C16 / 0.91 / 300
        sheet3_J16 = sheet6_D12 * sheet3_H16 / 1000
        sheet3_K16 = sheet6_D9 * sheet3_I16 / 1000
        sheet3_L16 = sheet6_D11 * sheet3_A16 / 1000 / 300
        sheet3_M16 = sheet3_J16 + sheet3_K16 + sheet3_L16

        # sheet3 table4
        sheet3_C19 = 87
        sheet3_D19 = 90
        sheet3_C20 = sheet2_F17
        sheet3_D20 = sheet2_F26
        sheet3_C21 = sheet3_C20 - sheet3_C19
        sheet3_D21 = sheet3_D20 - sheet3_D19

        if sheet3_C21 > -2 and sheet3_C21 < 0:
            sheet3_C26 = sheet3_J16 * (2 + sheet3_C21 - sheet2_F20)
        elif sheet3_C21 >= 0:
            sheet3_C26 = sheet3_J16 * (2 + sheet3_C21)
        elif sheet3_C21 <= -2:
            sheet3_C26 = 0

        if sheet3_D21 > -2.4799 and sheet3_D21 < 0:
            sheet3_D26 = sheet3_J16 * (2.48 + sheet3_D21 - sheet2_F29)
        elif sheet3_D21 >= 0:
            sheet3_D26 = sheet3_J16 * (2.48 + sheet3_D21)
        elif sheet3_D21 <= -2.4799:
            sheet3_D26 = 0

        if sheet3_C21 > -2 and sheet3_C21 < 0:
            sheet3_C27 = sheet3_K16 * (2 + sheet3_C21 - sheet2_F20)
        elif sheet3_C21 >= 0:
            sheet3_C27 = sheet3_K16 * (2 + sheet3_C21)
        elif sheet3_C21 <= -2:
            sheet3_C27 = 0

        if sheet3_D21 > -2.4799 and sheet3_D21 < 0:
            sheet3_D27 = sheet3_K16 * (2.48 + sheet3_D21 - sheet2_F29)
        elif sheet3_D21 >= 0:
            sheet3_D27 = sheet3_K16 * (2.48 + sheet3_D21)
        elif sheet3_D21 <= -2.4799:
            sheet3_D27 = 0

        if sheet3_C21 > -2 and sheet3_C21 < 0:
            sheet3_C28 = sheet3_L16 * (2 + sheet3_C21 - sheet2_F20)
        elif sheet3_C21 >= 0:
            sheet3_C28 = sheet3_L16 * (2 + sheet3_C21)
        elif sheet3_C21 <= -2:
            sheet3_C28 = 0

        if sheet3_D21 > -2.4799 and sheet3_D21 < 0:
            sheet3_D28 = sheet3_L16 * (2.48 + sheet3_D21 - (sheet2_C26 + sheet2_F29))
        elif sheet3_D21 >= 0:
            sheet3_D28 = sheet3_L16 * (2.48 + sheet3_D21)
        elif sheet3_D21 <= -2.4799:
            sheet3_D28 = 0

        sheet3_C29 = sheet3_C26 + sheet3_C27 + sheet3_C28
        sheet3_D29 = sheet3_D26 + sheet3_D27 + sheet3_D28

        # 以上两项合计影响 sheet3 table5

        sheet3_C37 = sheet3_C12 + sheet3_C26
        sheet3_D37 = sheet3_D12 + sheet3_D26
        sheet3_C38 = sheet3_C27
        sheet3_D38 = sheet3_D27
        sheet3_C39 = sheet3_C28
        sheet3_D39 = sheet3_D28

        # 铁水废钢价格影响 sheet4
        # 转炉影响测算=转炉原料结构（成本上升）+矿石投入减少废钢增加（成本上升） +转炉煤气回收减少（成本上升）+发热剂用量增加（成本上升）+钢铁料消耗上升+辅料成本上升
        # 1、铁水比每降低1%，外购废钢和铁水比等量代换后，性价比影响。 sheet4 table1

        # sheet4_B6 = 0.935
        sheet4_B7 = 0.945
        sheet4_C6 = sheet6_D6
        sheet4_C7 = sheet6_D5
        sheet4_D6 = sheet4_C6 / sheet4_B6
        sheet4_D7 = sheet4_C7 / sheet4_B7
        sheet4_E6 = sheet4_D6 - sheet4_D7
        sheet4_F6 = sheet4_E6 * 3.2 / 300
        # 装入量320吨，产出量300吨

        # sheet4 table2
        sheet4_C10 = 83.01
        sheet4_D10 = 85.93
        # 一、二炼钢分别以制造部数据83.01%、85.93%铁水比为基准
        sheet4_C11 = sheet7_B6 * 100
        sheet4_D11 = sheet7_C6 * 100
        sheet4_C12 = sheet4_C10 - sheet4_C11
        sheet4_D12 = sheet4_D10 - sheet4_D11
        sheet4_C13 = sheet4_F6 * sheet4_C12
        sheet4_D13 = sheet4_F6 * sheet4_D12

        # 过程数据汇总 sheet5
        # 铁水比变化对各项成本的影响汇总
        # 铁水比降低，可能引起耐材消耗增加，这部分成本暂不考虑。
        # （1）一炼钢成本影响值汇总 sheet5 table1
        sheet5_C6 = sheet4_C13
        sheet5_G6 = sheet5_C6
        sheet5_C7 = sheet3_C37
        sheet5_D7 = sheet3_C39
        sheet5_G7 = sheet5_C7 + sheet5_D7
        sheet5_D8 = sheet2_K20
        sheet5_F8 = sheet2_I20
        sheet5_G8 = sheet5_D8 + sheet5_F8
        sheet5_D9 = sheet2_J20 + sheet3_C38
        sheet5_G9 = sheet5_D9
        sheet5_F10 = sheet2_B38
        sheet5_G10 = sheet5_F10
        sheet5_G11 = sheet5_G6 + sheet5_G7 + sheet5_G8 + sheet5_G9 + sheet5_G10

        # （2）二炼钢成本影响值汇总 sheet5 table2
        sheet5_C15 = sheet4_D13
        sheet5_G15 = sheet5_C15
        sheet5_C16 = sheet3_D37
        sheet5_D16 = sheet3_D39
        sheet5_G16 = sheet5_C16 + sheet5_D16
        sheet5_D17 = sheet2_K29
        sheet5_F17 = sheet2_I29
        sheet5_G17 = sheet5_D17 + sheet5_F17
        sheet5_D18 = sheet2_J29 + sheet3_D38
        sheet5_G18 = sheet5_D18
        sheet5_F19 = sheet2_C38
        sheet5_G19 = sheet5_F19
        sheet5_G20 = sheet5_G15 + sheet5_G16 + sheet5_G17 + sheet5_G18 + sheet5_G19

        # 计算总结果 sheet7
        # 铁水比变动对效益的影响
        # 说明：下表输入拟铁水比值就直接得出结果；其它有底色的不能修改。 sheet7 table1

        sheet7_D4 = sheet7_B4 + sheet7_C4
        sheet7_B5 = 0.8301
        sheet7_C5 = 0.8593

        sheet7_D7 = sheet7_B7 + sheet7_C7

        sheet7_D8 = sheet7_B8 + sheet7_C8
        # 铁水比变化炼钢成本变化结果 sheet7 table2

        sheet7_B13 = sheet5_G11 * sheet7_B8
        sheet7_C13 = sheet5_G20 * sheet7_C8
        sheet7_D13 = sheet7_B13 + sheet7_C13
        # 正数为增加成本，负数为降低成本

        sheet7_B14 = sheet7_B13 / sheet7_B8
        sheet7_C14 = sheet7_C13 / sheet7_C8
        sheet7_D14 = sheet7_B14 + sheet7_C14
        # 正数为增加成本，负数为降低成本


        if code == 0:
            return sheet7_D13

        if code == 1:
            workbook = xlsxwriter.Workbook('sheet1.xlsx')  # 建立文件

            worksheet7 = workbook.add_worksheet(
                '计算总结果')
            worksheet7.write('A1', '铁水比变动对效益的影响')
            worksheet7.write('A2', '说明：下表输入拟铁水比值就直接得出结果；其它有底色的不能修改。')
            worksheet7.write('A4', '本月计划铁水量，万吨/月')
            worksheet7.write('A5', '标准铁水比')
            worksheet7.write('A6', '拟铁水比')
            worksheet7.write('A7', '本月计划钢产量，万吨')
            worksheet7.write('A8', '本月计划钢水产量，万吨')
            worksheet7.write('A9', '连铸收得率')
            worksheet7.write('A11', '铁水比变化炼钢成本变化结果')
            worksheet7.write('A13', '炼钢成本变化值，万元')
            worksheet7.write('A14', '炼钢吨钢成本变化值，元/吨')
            worksheet7.write('B3', '一炼钢')
            worksheet7.write('C3', '二炼钢')
            worksheet7.write('D3', '合计')
            worksheet7.write('E3', '备注')
            worksheet7.write('E4', '人工输入')
            worksheet7.write('E5', '制造部2020年数据')
            worksheet7.write('E6', '人工输入（一炼钢81~83.5%，二炼钢84~86.5%），高炉不增产')
            worksheet7.write('E7', '人工输入')
            worksheet7.write('E8', '本月计划钢产量/连铸收得率')
            worksheet7.write('E9', '已知，年计划值')
            worksheet7.write('B12', '一炼钢')
            worksheet7.write('C12', '二炼钢')
            worksheet7.write('D12', '合计')
            worksheet7.write('E13', '正数为增加成本，负数为降低成本')
            worksheet7.write('E14', '正数为增加成本，负数为降低成本')

            worksheet7.write('B4', sheet7_B4)
            worksheet7.write('B5', sheet7_B5)
            worksheet7.write('B6', sheet7_B6)
            worksheet7.write('B7', sheet7_B7)
            worksheet7.write('B8', sheet7_B8)
            worksheet7.write('B9', sheet7_B9)
            worksheet7.write('C4', sheet7_C4)
            worksheet7.write('C5', sheet7_C5)
            worksheet7.write('C6', sheet7_C6)
            worksheet7.write('C7', sheet7_C7)
            worksheet7.write('C8', sheet7_C8)
            worksheet7.write('C9', sheet7_C9)
            worksheet7.write('D4', sheet7_D4)
            worksheet7.write('D7', sheet7_D7)
            worksheet7.write('D8', sheet7_D8)
            worksheet7.write('B13', sheet7_B13)
            worksheet7.write('B14', sheet7_B14)
            worksheet7.write('C13', sheet7_C13)
            worksheet7.write('C14', sheet7_C14)
            worksheet7.write('D13', sheet7_D13)
            worksheet7.write('D14', sheet7_D14)

            worksheet6 = workbook.add_worksheet(
                '各种价格及参数输入画面')
            worksheet6.write('A1', '各种参数维护')
            worksheet6.write('A2', '说明：白底可以输入，有色底不能修改。')
            worksheet6.write('A3', '1、各种主原料、副原料成本')
            worksheet6.write('C3', '2020预算价格')
            worksheet6.write('D3', '当月价格预计')
            worksheet6.write('A4', '序号')
            worksheet6.write('B4', '名称')
            worksheet6.write('C4', '单价，元/吨')
            worksheet6.write('D4', '单价，元/吨')
            worksheet6.write('A5', '1')
            worksheet6.write('A6', '2')
            worksheet6.write('A7', '3')
            worksheet6.write('A8', '4')
            worksheet6.write('A9', '5')
            worksheet6.write('A10', '6')
            worksheet6.write('A11', '7')
            worksheet6.write('A12', '8')
            worksheet6.write('B5', '铁水成本')
            worksheet6.write('B6', '外购中混废钢')
            worksheet6.write('B7', '一炼钢废钢平均价格')
            worksheet6.write('B8', '二炼钢废钢平均价格')
            worksheet6.write('B9', '外购石灰')
            worksheet6.write('B10', '硅铁碳球发热剂')
            worksheet6.write('B11', '铁矿石')
            worksheet6.write('B12', '主原料钢铁料成本')
            worksheet6.write('A14', '2、转炉用铁矿石成分')
            worksheet6.write('A15', '成分')
            worksheet6.write('B15', 'T.Fe')
            worksheet6.write('C15', 'SiO2')
            worksheet6.write('D15', '备注')
            worksheet6.write('A16', '含量，%')
            worksheet6.write('D16', '2019.3月平均')
            worksheet6.write('A18', '3、一、二炼钢铁水量分配比例及铁水比和钢铁料计划值')
            worksheet6.write('A19', '单元')
            worksheet6.write('B19', '铁水量，万吨/月')
            worksheet6.write('C19', '铁水分配比例')
            worksheet6.write('D19', '计划铁水比')
            worksheet6.write('E19', '计划钢水钢铁料消耗，kg/t')
            worksheet6.write('F19', '连铸收得率')
            worksheet6.write('G19', '备注')
            worksheet6.write('G20', '铁水比83.01%的钢铁料消耗，2020年1-12月连铸收得率')
            worksheet6.write('G21', '铁水比85.93%的钢铁料消耗，2020年1-12月连铸收得率')
            worksheet6.write('A20', '一炼钢')
            worksheet6.write('A21', '二炼钢')
            worksheet6.write('A23', '4、铁水Si含量和入炉温度')
            worksheet6.write('B24', '铁水Si，%')
            worksheet6.write('C24', '入炉温度，℃')
            worksheet6.write('D24', '备注')
            worksheet6.write('A25', '一炼钢')
            worksheet6.write('A26', '二炼钢')
            worksheet6.write('D25', '可输入预测值')
            worksheet6.write('D26', '可输入预测值')
            worksheet6.write('A28', '4.5、转炉停吹温度')
            worksheet6.write('C29', '停吹温度，℃')
            worksheet6.write('D29', '备注')
            worksheet6.write('A30', '一炼钢')
            worksheet6.write('A31', '二炼钢')
            worksheet6.write('D30', '可输入预测值')
            worksheet6.write('D31', '可输入预测值')
            worksheet6.write('A33', '5、炉渣装入碱度和渣中(T.Fe)')
            worksheet6.write('B34', '装入碱度')
            worksheet6.write('C34', '炉渣(T.Fe)含量')
            worksheet6.write('D34', '备注')
            worksheet6.write('A35', '一炼钢')
            worksheet6.write('A36', '二炼钢')
            worksheet6.write('D35', '暂不变化')
            worksheet6.write('D36', '暂不变化')
            worksheet6.write('C5', sheet6_C5)
            worksheet6.write('C6', sheet6_C6)
            worksheet6.write('C9', sheet6_C9)
            worksheet6.write('C10', sheet6_C10)
            worksheet6.write('C11', sheet6_C11)
            worksheet6.write('C12', sheet6_C12)
            worksheet6.write('D5', sheet6_D5)
            worksheet6.write('D6', sheet6_D6)
            worksheet6.write('D9', sheet6_D9)
            worksheet6.write('D10', sheet6_D10)
            worksheet6.write('D11', sheet6_D11)
            worksheet6.write('D12', sheet6_D12)
            worksheet6.write('B16', sheet6_B16)
            worksheet6.write('C16', sheet6_C16)
            worksheet6.write('B20', sheet6_B20)
            worksheet6.write('B21', sheet6_B21)
            worksheet6.write('C20', sheet6_C20)
            worksheet6.write('C21', sheet6_C21)
            worksheet6.write('D20', sheet6_D20)
            worksheet6.write('D21', sheet6_D21)
            worksheet6.write('E20', sheet6_E20)
            worksheet6.write('E21', sheet6_E21)
            worksheet6.write('F20', sheet6_F20)
            worksheet6.write('F21', sheet6_F21)
            worksheet6.write('B25', sheet6_B25)
            worksheet6.write('B26', sheet6_B26)
            worksheet6.write('C25', sheet6_C25)
            worksheet6.write('C26', sheet6_C26)
            worksheet6.write('C30', sheet6_C30)
            worksheet6.write('C31', sheet6_C31)
            worksheet6.write('B35', sheet6_B35)
            worksheet6.write('B36', sheet6_B36)
            worksheet6.write('C35', sheet6_C35)
            worksheet6.write('C36', sheet6_C36)

            worksheet5 = workbook.add_worksheet(
                '过程数据汇总')
            worksheet5.write('A1', '铁水比变化对各项成本的影响汇总')
            worksheet5.write('A3', '铁水比降低，可能引起耐材消耗增加，这部分成本暂不考虑。')
            worksheet5.write('A4', '（1）一炼钢成本影响值汇总（单位：元/吨钢）')
            worksheet5.write('A6', '1')
            worksheet5.write('A7', '2')
            worksheet5.write('A8', '3')
            worksheet5.write('A9', '4')
            worksheet5.write('A10', '5')
            worksheet5.write('A11', '6')
            worksheet5.write('A13', '（2）二炼钢成本影响值汇总（单位：元/吨钢）')
            worksheet5.write('A15', '1')
            worksheet5.write('A16', '2')
            worksheet5.write('A17', '3')
            worksheet5.write('A18', '4')
            worksheet5.write('A19', '5')
            worksheet5.write('A20', '6')
            worksheet5.write('B5', '项目')
            worksheet5.write('B6', '增加废钢量')
            worksheet5.write('B7', '矿石冷却剂')
            worksheet5.write('B8', '发热剂')
            worksheet5.write('B9', '石灰')
            worksheet5.write('B10', '炉次过吹造成铁损')
            worksheet5.write('B11', '合计')
            worksheet5.write('B14', '项目')
            worksheet5.write('B15', '增加废钢量')
            worksheet5.write('B16', '矿石冷却剂')
            worksheet5.write('B17', '发热剂')
            worksheet5.write('B18', '石灰')
            worksheet5.write('B19', '炉次过吹造成铁损')
            worksheet5.write('B20', '合计')
            worksheet5.write('C5', '主原料影响')
            worksheet5.write('D5', '辅料影响')
            worksheet5.write('E5', '能源影响')
            worksheet5.write('F5', '钢铁料影响')
            worksheet5.write('G5', '合计影响')
            worksheet5.write('H5', '计算前提')
            worksheet5.write('I5', '备注')
            worksheet5.write('H6', '无')
            worksheet5.write('H9', '随发热剂和铁矿石用量自动计算')
            worksheet5.write('I6', '以制造部铁水比83.01%为基准计算值')
            worksheet5.write('I7', '以制造部铁水比83.01%为基准计算值')
            worksheet5.write('I8', '以制造部铁水比83.01%为基准计算值')
            worksheet5.write('I9', '以制造部铁水比83.01%为基准计算值')
            worksheet5.write('I10', '以制造部铁水比83.01%为基准计算值')
            worksheet5.write('I11', '炼钢产量不变')
            worksheet5.write('C14', '主原料影响')
            worksheet5.write('D14', '辅料影响')
            worksheet5.write('E14', '能源影响')
            worksheet5.write('F14', '钢铁料影响')
            worksheet5.write('G14', '合计影响')
            worksheet5.write('H14', '计算前提')
            worksheet5.write('I14', '备注')
            worksheet5.write('H15', '无')
            worksheet5.write('H18', '随发热剂和铁矿石用量自动计算')
            worksheet5.write('I15', '以制造部铁水比85.93%为基准计算值')
            worksheet5.write('I16', '以制造部铁水比85.93%为基准计算值')
            worksheet5.write('I17', '以制造部铁水比85.93%为基准计算值')
            worksheet5.write('I18', '以制造部铁水比85.93%为基准计算值')
            worksheet5.write('I19', '以制造部铁水比85.93%为基准计算值')
            worksheet5.write('I20', '炼钢产量不变')
            worksheet5.write('C6', sheet5_C6)
            worksheet5.write('C7', sheet5_C7)
            worksheet5.write('D7', sheet5_D7)
            worksheet5.write('D8', sheet5_D8)
            worksheet5.write('D9', sheet5_D9)
            worksheet5.write('F8', sheet5_F8)
            worksheet5.write('F10', sheet5_F10)
            worksheet5.write('G6', sheet5_G6)
            worksheet5.write('G7', sheet5_G7)
            worksheet5.write('G8', sheet5_G8)
            worksheet5.write('G9', sheet5_G9)
            worksheet5.write('G10', sheet5_G10)
            worksheet5.write('G11', sheet5_G11)
            worksheet5.write('C15', sheet5_C15)
            worksheet5.write('C16', sheet5_C16)
            worksheet5.write('D16', sheet5_D16)
            worksheet5.write('D17', sheet5_D17)
            worksheet5.write('D18', sheet5_D18)
            worksheet5.write('F17', sheet5_F17)
            worksheet5.write('F19', sheet5_F19)
            worksheet5.write('G15', sheet5_G15)
            worksheet5.write('G16', sheet5_G16)
            worksheet5.write('G17', sheet5_G17)
            worksheet5.write('G18', sheet5_G18)
            worksheet5.write('G19', sheet5_G19)
            worksheet5.write('G20', sheet5_G20)

            worksheet4 = workbook.add_worksheet(
                '铁水废钢价格影响')
            worksheet4.write('A1', '转炉影响测算=转炉原料结构（成本上升）+矿石投入减少废钢增加（成本上升） +转炉煤气回收减少（成本上升）+发热剂用量增加（成本上升）+钢铁料消耗上升+辅料成本上升')
            worksheet4.write('A4', '1、铁水比每降低1%，外购废钢和铁水比等量代换后，性价比影响。')
            worksheet4.write('A5', '品名')
            worksheet4.write('A6', '废钢综合')
            worksheet4.write('A7', '铁水成本')
            worksheet4.write('B5', '收得率')
            worksheet4.write('C5', '进成本价')
            worksheet4.write('D5', '吨金属价格')
            worksheet4.write('E5', '与铁水变动成本价差')
            worksheet4.write('F5', '对吨钢影响')
            worksheet4.write('G6', '装入量320吨，产出量300吨')
            worksheet4.write('B9', '项目')
            worksheet4.write('B10', '标准铁水比，%')
            worksheet4.write('B11', '计算铁水比参数，%')
            worksheet4.write('B12', '铁水比变化，%')
            worksheet4.write('B13', '吨钢成本影响，元/吨钢')
            worksheet4.write('C9', '一炼钢')
            worksheet4.write('D9', '二炼钢')
            worksheet4.write('E9', '备注')
            worksheet4.write('E10', '一、二炼钢分别以制造部数据83.01%、85.93%铁水比为基准')
            worksheet4.write('E13', '一、二炼钢分别以制造部数据83.01%、85.93%铁水比为基准')
            worksheet4.write('B6', sheet4_B6)
            worksheet4.write('B7', sheet4_B7)
            worksheet4.write('C6', sheet4_C6)
            worksheet4.write('C7', sheet4_C7)
            worksheet4.write('D6', sheet4_D6)
            worksheet4.write('D7', sheet4_D7)
            worksheet4.write('E6', sheet4_E6)
            worksheet4.write('F6', sheet4_F6)
            worksheet4.write('C10', sheet4_C10)
            worksheet4.write('C11', sheet4_C11)
            worksheet4.write('C12', sheet4_C12)
            worksheet4.write('C13', sheet4_C13)
            worksheet4.write('D10', sheet4_D10)
            worksheet4.write('D11', sheet4_D11)
            worksheet4.write('D12', sheet4_D12)
            worksheet4.write('D13', sheet4_D13)

            worksheet3 = workbook.add_worksheet(
                '矿石用量影响')
            worksheet3.write('A1', '2、铁水比降低1%，转炉入炉原料热值减少，废钢用量增加，矿石投入减少。 ')
            worksheet3.write('A2', '项目')
            worksheet3.write('A3', '矿石')
            worksheet3.write('A4', '废钢')
            worksheet3.write('A5', '合计')
            worksheet3.write('B2', '铁水比降低1%单耗变动值')
            worksheet3.write('C2', '预测月进成本价')
            worksheet3.write('D2', '影响吨钢成本')
            worksheet3.write('E3', '备注：装入量按照320吨计算')
            worksheet3.write('B7', '项目')
            worksheet3.write('B8', '标准铁水比（计划铁水比），%')
            worksheet3.write('B9', '计算铁水比过程参数，%')
            worksheet3.write('B10', '铁水比变化，%')
            worksheet3.write('B11', '吨钢成本变化，元/吨钢')
            worksheet3.write('B12', '吨钢成本变化，元/吨钢')
            worksheet3.write('C7', '一炼钢')
            worksheet3.write('D7', '二炼钢')
            worksheet3.write('E7', '备注')
            worksheet3.write('E11', '一、二炼钢分别以87%、90%铁水比为基准')
            worksheet3.write('E12', '一、二炼钢分别以制造部数据83.01%、85.93%铁水比为基准')
            worksheet3.write('A14', '铁水比变化1%引起的矿石量变化对钢铁料消耗和石灰消耗的影响')
            worksheet3.write('A15', '矿石投入量，kg')
            worksheet3.write('B15', '矿石SiO2含量，%')
            worksheet3.write('C15', '渣碱度')
            worksheet3.write('D15', '渣量增加值，kg/炉')
            worksheet3.write('E15', '渣中(T.Fe)含量')
            worksheet3.write('F15', '渣中铁损失增加值，kg/炉')
            worksheet3.write('G15', '钢水回收量增加，kg/炉')
            worksheet3.write('H15', '钢铁料变化值，kg/t')
            worksheet3.write('I15', '石灰消耗增加值，kg/t')
            worksheet3.write('J15', '钢铁料成本变化值，元/吨钢')
            worksheet3.write('K15', '石灰成本变化值，元/吨钢')
            worksheet3.write('L15', '矿石成本变化值，元/吨钢')
            worksheet3.write('M15', '合计成本变化值，元/吨钢')
            worksheet3.write('B18', '项目')
            worksheet3.write('B19', '标准铁水比（计划铁水比），%')
            worksheet3.write('B20', '计算铁水比过程参数，%')
            worksheet3.write('B21', '铁水比变化，%')
            worksheet3.write('B22', '钢铁料成本变化，元/吨钢')
            worksheet3.write('B23', '石灰成本变化，元/吨钢')
            worksheet3.write('B24', '矿石成本，元/吨钢')
            worksheet3.write('B25', '合计吨钢成本变化，元/吨钢')
            worksheet3.write('B26', '钢铁料成本变化，元/吨钢')
            worksheet3.write('B27', '石灰成本变化，元/吨钢')
            worksheet3.write('B28', '矿石成本，元/吨钢')
            worksheet3.write('B29', '合计吨钢成本变化，元/吨钢')
            worksheet3.write('C18', '一炼钢')
            worksheet3.write('D18', '二炼钢')
            worksheet3.write('E18', '备注')
            worksheet3.write('E22', '一、二炼钢分别以87%、90%铁水比为基准，超过才计算')
            worksheet3.write('E26', '一、二炼钢分别以制造部数据83.01%、85.93%铁水比为基准')
            worksheet3.write('A32', '以上两项合计影响')
            worksheet3.write('B33', '项目')
            worksheet3.write('B34', '钢铁料成本变化，元/吨钢')
            worksheet3.write('B35', '石灰成本变化，元/吨钢')
            worksheet3.write('B36', '矿石成本，元/吨钢')
            worksheet3.write('B37', '钢铁料吨钢成本变化，元/吨钢')
            worksheet3.write('B38', '石灰吨钢成本变化，元/吨钢')
            worksheet3.write('B39', '矿石成本，元/吨钢')
            worksheet3.write('C33', '一炼钢')
            worksheet3.write('D33', '二炼钢')
            worksheet3.write('E33', '备注')
            worksheet3.write('E34', '一、二炼钢分别以87%、90%铁水比为基准，超过才计算')
            worksheet3.write('E37', '一、二炼钢分别以制造部数据83.01%、85.93%铁水比为基准')
            worksheet3.write('B3', sheet3_B3)
            worksheet3.write('B4', sheet3_B4)
            worksheet3.write('C3', sheet3_C3)
            worksheet3.write('C4', sheet3_C4)
            worksheet3.write('D3', sheet3_D3)
            worksheet3.write('D4', sheet3_D4)
            worksheet3.write('D5', sheet3_D5)
            worksheet3.write('C8', sheet3_C8)
            worksheet3.write('C9', sheet3_C9)
            worksheet3.write('C10', sheet3_C10)
            worksheet3.write('C12', sheet3_C12)
            worksheet3.write('D8', sheet3_D8)
            worksheet3.write('D9', sheet3_D9)
            worksheet3.write('D10', sheet3_D10)
            worksheet3.write('D12', sheet3_D12)
            worksheet3.write('A16', sheet3_A16)
            worksheet3.write('B16', sheet3_B16)
            worksheet3.write('C16', sheet3_C16)
            worksheet3.write('D16', sheet3_D16)
            worksheet3.write('E16', sheet3_E16)
            worksheet3.write('F16', sheet3_F16)
            worksheet3.write('G16', sheet3_G16)
            worksheet3.write('H16', sheet3_H16)
            worksheet3.write('I16', sheet3_I16)
            worksheet3.write('J16', sheet3_J16)
            worksheet3.write('K16', sheet3_K16)
            worksheet3.write('L16', sheet3_L16)
            worksheet3.write('M16', sheet3_M16)
            worksheet3.write('C19', sheet3_C19)
            worksheet3.write('C20', sheet3_C20)
            worksheet3.write('C21', sheet3_C21)
            worksheet3.write('D19', sheet3_D19)
            worksheet3.write('D20', sheet3_D20)
            worksheet3.write('D21', sheet3_D21)
            worksheet3.write('C26', sheet3_C26)
            worksheet3.write('C27', sheet3_C27)
            worksheet3.write('C28', sheet3_C28)
            worksheet3.write('C29', sheet3_C29)
            worksheet3.write('D26', sheet3_D26)
            worksheet3.write('D27', sheet3_D27)
            worksheet3.write('D28', sheet3_D28)
            worksheet3.write('D29', sheet3_D29)
            worksheet3.write('C37', sheet3_C37)
            worksheet3.write('C38', sheet3_C38)
            worksheet3.write('C39', sheet3_C39)
            worksheet3.write('D37', sheet3_D37)
            worksheet3.write('D38', sheet3_D38)
            worksheet3.write('D39', sheet3_D39)

            worksheet2 = workbook.add_worksheet('发热剂对石灰及铁损影响')
            worksheet2.write('A1', '3、加发热剂对钢铁料消耗的影响')
            worksheet2.write('A2', '序号')
            worksheet2.write('A3', '1（一炼钢）')
            worksheet2.write('A4', '2（二炼钢）')
            worksheet2.write('B2', '发热剂种类')
            worksheet2.write('B3', '硅铁碳球')
            worksheet2.write('B4', '硅铁碳球')
            worksheet2.write('C2', '发热剂Si含量')
            worksheet2.write('C3', sheet2_C3)
            worksheet2.write('C4', sheet2_C4)
            worksheet2.write('D2', '发热剂加入量，kg/炉')
            worksheet2.write('D3', sheet2_D3)
            worksheet2.write('D4', sheet2_D4)
            worksheet2.write('E2', 'SiO2产生量，kg')
            worksheet2.write('E3', sheet2_E3)
            worksheet2.write('E4', sheet2_E4)
            worksheet2.write('F2', '装入碱度')
            worksheet2.write('F3', sheet2_F3)
            worksheet2.write('F4', sheet2_F4)
            worksheet2.write('G2', '渣量增加值，kg/炉')
            worksheet2.write('G3', sheet2_G3)
            worksheet2.write('G4', sheet2_G4)
            worksheet2.write('H2', '发热剂中的灰分带入产生的渣量，kg')
            worksheet2.write('H3', sheet2_H3)
            worksheet2.write('H4', sheet2_H4)
            worksheet2.write('I2', '总渣量增加值，kg/炉')
            worksheet2.write('I3', sheet2_I3)
            worksheet2.write('I4', sheet2_I4)
            worksheet2.write('J2', '渣中(T.Fe)含量')
            worksheet2.write('J3', sheet2_J3)
            worksheet2.write('J4', sheet2_J4)
            worksheet2.write('K2', '渣中铁损失增加值，kg/炉')
            worksheet2.write('K3', sheet2_K3)
            worksheet2.write('K4', sheet2_K4)
            worksheet2.write('L2', '钢铁料增加值，kg/t')
            worksheet2.write('L3', sheet2_L3)
            worksheet2.write('L4', sheet2_L4)
            worksheet2.write('M2', '石灰消耗增加值,kg/t')
            worksheet2.write('M3', sheet2_M3)
            worksheet2.write('M4', sheet2_M4)
            worksheet2.write('N2', '钢铁料成本增加，元/吨钢')
            worksheet2.write('N3', sheet2_N3)
            worksheet2.write('N4', sheet2_N4)
            worksheet2.write('O2', '石灰成本增加，元/吨钢')
            worksheet2.write('O3', sheet2_O3)
            worksheet2.write('O4', sheet2_O4)
            worksheet2.write('P2', '发热剂成本，元/吨钢')
            worksheet2.write('P3', sheet2_P3)
            worksheet2.write('P4', sheet2_P4)
            worksheet2.write('Q2', '成本增加小计，元/吨钢')
            worksheet2.write('Q3', sheet2_Q3)
            worksheet2.write('Q4', sheet2_Q4)
            worksheet2.write('A7', '转炉热量不平衡引起的过吹造成的损失（单炉）')
            worksheet2.write('A9', '渣中（T.Fe）一炼钢')
            worksheet2.write('A10', '渣中（T.Fe）二炼钢')
            worksheet2.write('B8', '正常')
            worksheet2.write('C8', '过吹')
            worksheet2.write('D8', '铁损失，kg/吨钢')
            worksheet2.write('B9', sheet2_B9)
            worksheet2.write('B10', sheet2_B10)
            worksheet2.write('C9', sheet2_C9)
            worksheet2.write('C10', sheet2_C10)
            worksheet2.write('D9', sheet2_D9)
            worksheet2.write('D10', sheet2_D10)
            worksheet2.write('E9', '备注：炉渣量29吨/炉')
            worksheet2.write('A12', '备注：潜在隐形成本未考虑，随着发热剂硅元素增加，喷溅加大，增加环保和钢铁料消耗成本增加。')
            worksheet2.write('A15', '一炼钢系数')
            worksheet2.write('A16', '铁水比')
            worksheet2.write('A17', '87-86%')
            worksheet2.write('A18', '86-85%')
            worksheet2.write('A19', '85-84%')
            worksheet2.write('A20', '84-83%')
            worksheet2.write('A21', '83-82%')
            worksheet2.write('A22', '82-81%')
            worksheet2.write('A24', '二炼钢系数')
            worksheet2.write('A25', '铁水比')
            worksheet2.write('A26', '90-89%')
            worksheet2.write('A27', '89-88%')
            worksheet2.write('A28', '88-87%')
            worksheet2.write('A29', '87-86%')
            worksheet2.write('A30', '86-85%')
            worksheet2.write('A31', '85-84%')
            worksheet2.write('A32', '6、炉次过吹造成铁损')
            worksheet2.write('A33', '项目')
            worksheet2.write('A34', '标准铁水比（计划铁水比），%')
            worksheet2.write('A35', '计算铁水比过程参数，%')
            worksheet2.write('A36', '铁水比变化，%')
            worksheet2.write('A37', '过吹综合比例')
            worksheet2.write('A38', '吨钢成本变化，元/吨钢')
            worksheet2.write('B16', '发热剂加入炉次比例')
            worksheet2.write('C16', '发热剂系数')
            worksheet2.write('D16', '吹损炉次增加比例系数')
            worksheet2.write('E16', '标准铁水比（计划铁水比），%')
            worksheet2.write('E17', '计算铁水比参数，%')
            worksheet2.write('E18', '铁水比变化调整值，%')
            worksheet2.write('E19', '发热剂综合系数(87%为基准计算）')
            worksheet2.write('E20', '发热剂综合系数(83.01%为基准计算）')
            worksheet2.write('B25', '发热剂加入炉次比例')
            worksheet2.write('C25', '发热剂系数')
            worksheet2.write('D25', '吹损炉次增加比例系数')
            worksheet2.write('E25', '标准铁水比（计划铁水比）')
            worksheet2.write('E26', '计算铁水比参数，%')
            worksheet2.write('E27', '铁水比变化调整值，%')
            worksheet2.write('E28', '发热剂综合系数(90%为基准计算）')
            worksheet2.write('E29', '发热剂综合系数(85.93%为基准计算）')
            worksheet2.write('B33', '一炼钢')
            worksheet2.write('C33', '二炼钢')
            worksheet2.write('D33', '备注')
            worksheet2.write('D37', '一、二炼钢分别以制造部数据83.01%、85.93%铁水比为基准')
            worksheet2.write('D38', '一、二炼钢分别以制造部数据83.01%、85.93%铁水比为基准')
            worksheet2.write('H15', '铁水比变化加硅铁碳球对吹炼铁损和石灰消耗的影响')
            worksheet2.write('H17', '消耗增加值，kg/t')
            worksheet2.write('H18', '成本变化值，元/t')
            worksheet2.write('H19', '消耗增加值，kg/t')
            worksheet2.write('H20', '成本变化值，元/t')
            worksheet2.write('I16', '吹炼铁损失')
            worksheet2.write('J16', '石灰消耗')
            worksheet2.write('K16', '发热剂')
            worksheet2.write('L16', '小计')
            worksheet2.write('M16', '备注')
            worksheet2.write('M17', '铁水比87%为基准')
            worksheet2.write('M19', '以制造部1-12月铁水比83.01%为基准')
            worksheet2.write('H24', '铁水比变化加硅铁碳球对吹炼铁损和石灰消耗的影响')
            worksheet2.write('H26', '消耗增加值，kg/t')
            worksheet2.write('H27', '成本变化值，元/t')
            worksheet2.write('H28', '消耗增加值，kg/t')
            worksheet2.write('H29', '成本变化值，元/t')
            worksheet2.write('I25', '吹炼铁损失')
            worksheet2.write('J25', '石灰消耗')
            worksheet2.write('K25', '发热剂')
            worksheet2.write('L25', '小计')
            worksheet2.write('M25', '备注')
            worksheet2.write('M26', '铁水比90%为基准')
            worksheet2.write('M28', '以制造部1-12月铁水比85.93%为基准')
            worksheet2.write('B17', sheet2_B17)
            worksheet2.write('B18', sheet2_B18)
            worksheet2.write('B19', sheet2_B19)
            worksheet2.write('B20', sheet2_B20)
            worksheet2.write('B21', sheet2_B21)
            worksheet2.write('B22', sheet2_B22)
            worksheet2.write('C17', sheet2_C17)
            worksheet2.write('C18', sheet2_C18)
            worksheet2.write('C19', sheet2_C19)
            worksheet2.write('C20', sheet2_C20)
            worksheet2.write('C21', sheet2_C21)
            worksheet2.write('C22', sheet2_C22)
            worksheet2.write('D17', sheet2_D17)
            worksheet2.write('D18', sheet2_D18)
            worksheet2.write('D19', sheet2_D19)
            worksheet2.write('D20', sheet2_D20)
            worksheet2.write('D21', sheet2_D21)
            worksheet2.write('D22', sheet2_D22)
            worksheet2.write('B26', sheet2_B26)
            worksheet2.write('B27', sheet2_B27)
            worksheet2.write('B28', sheet2_B28)
            worksheet2.write('B29', sheet2_B29)
            worksheet2.write('B30', sheet2_B30)
            worksheet2.write('B31', sheet2_B31)
            worksheet2.write('C26', sheet2_C26)
            worksheet2.write('C27', sheet2_C27)
            worksheet2.write('C28', sheet2_C28)
            worksheet2.write('C29', sheet2_C29)
            worksheet2.write('C30', sheet2_C30)
            worksheet2.write('C31', sheet2_C31)
            worksheet2.write('D26', sheet2_D26)
            worksheet2.write('D27', sheet2_D27)
            worksheet2.write('D28', sheet2_D28)
            worksheet2.write('D29', sheet2_D29)
            worksheet2.write('D30', sheet2_D30)
            worksheet2.write('D31', sheet2_D31)
            worksheet2.write('B34', sheet2_B34)
            worksheet2.write('B35', sheet2_B35)
            worksheet2.write('B36', sheet2_B36)
            worksheet2.write('B37', sheet2_B37)
            worksheet2.write('B38', sheet2_B38)
            worksheet2.write('C34', sheet2_C34)
            worksheet2.write('C35', sheet2_C35)
            worksheet2.write('C36', sheet2_C36)
            worksheet2.write('C37', sheet2_C37)
            worksheet2.write('C38', sheet2_C38)
            worksheet2.write('F16', sheet2_F16)
            worksheet2.write('F17', sheet2_F17)
            worksheet2.write('F18', sheet2_F18)
            worksheet2.write('F20', sheet2_F20)
            worksheet2.write('F25', sheet2_F25)
            worksheet2.write('F26', sheet2_F26)
            worksheet2.write('F27', sheet2_F27)
            worksheet2.write('F29', sheet2_F29)
            worksheet2.write('I19', sheet2_I19)
            worksheet2.write('I20', sheet2_I20)
            worksheet2.write('J19', sheet2_J19)
            worksheet2.write('J20', sheet2_J20)
            worksheet2.write('K19', sheet2_K19)
            worksheet2.write('K20', sheet2_K20)
            worksheet2.write('L20', sheet2_L20)
            worksheet2.write('I28', sheet2_I28)
            worksheet2.write('I29', sheet2_I29)
            worksheet2.write('J28', sheet2_J28)
            worksheet2.write('J29', sheet2_J29)
            worksheet2.write('K28', sheet2_K28)
            worksheet2.write('K29', sheet2_K29)
            worksheet2.write('L29', sheet2_L29)

            worksheet1 = workbook.add_worksheet('铁水温度成分停吹温度影响')
            # worksheet = workbook.add_worksheet()
            # 建立sheet， 可以work.add_worksheet('employee')来指定sheet名，但中文名会报UnicodeDecodeErro的错误
            # worksheet.write('A1', 'Hello world')  # 向A1写入
            # worksheet.write(1, 1, 'guoshun')  # 向第二行第二例写入guoshun
            worksheet1.write('A1', '铁水温度的影响')
            worksheet1.write('F1', '铁水Si的影响')
            worksheet1.write('K1', '停吹温度的影响')
            worksheet1.write('A3', '项目')
            worksheet1.write('B3', '一炼钢')
            worksheet1.write('C3', '二炼钢')
            worksheet1.write('D3', '备注')
            worksheet1.write('A4', '标准温度，℃')
            worksheet1.write('A5', '预计温度，℃')
            worksheet1.write('A6', '温度差值，℃')
            worksheet1.write('A7', '折算冷却能')
            worksheet1.write('D4', '2020年1-12月数据')
            worksheet1.write('D6', 'Min为-25℃')
            worksheet1.write('F3', '项目')
            worksheet1.write('G3', '一炼钢')
            worksheet1.write('H3', '二炼钢')
            worksheet1.write('I3', '备注')
            worksheet1.write('F4', '标准温度，℃')
            worksheet1.write('F5', '预计温度，℃')
            worksheet1.write('F6', '温度差值，℃')
            worksheet1.write('F7', '折算冷却能')
            worksheet1.write('I4', '2020年1-12月数据')
            worksheet1.write('K3', '项目')
            worksheet1.write('L3', '一炼钢')
            worksheet1.write('M3', '二炼钢')
            worksheet1.write('N3', '备注')
            worksheet1.write('K4', '标准温度，℃')
            worksheet1.write('K5', '预计温度，℃')
            worksheet1.write('K6', '温度差值，℃')
            worksheet1.write('K7', '折算冷却能')
            worksheet1.write('N4', '2020年1-12月数据')
            worksheet1.write('B4', sheet1_B4)
            worksheet1.write('B5', sheet1_B5)
            worksheet1.write('B6', sheet1_B6)
            worksheet1.write('B7', sheet1_B7)
            worksheet1.write('C4', sheet1_C4)
            worksheet1.write('C5', sheet1_C5)
            worksheet1.write('C6', sheet1_C6)
            worksheet1.write('C7', sheet1_C7)
            worksheet1.write('G4', sheet1_G4)
            worksheet1.write('G5', sheet1_G5)
            worksheet1.write('G6', sheet1_G6)
            worksheet1.write('G7', sheet1_G7)
            worksheet1.write('H4', sheet1_H4)
            worksheet1.write('H5', sheet1_H5)
            worksheet1.write('H6', sheet1_H6)
            worksheet1.write('H7', sheet1_H7)
            worksheet1.write('L4', sheet1_L4)
            worksheet1.write('L5', sheet1_L5)
            worksheet1.write('L6', sheet1_L6)
            worksheet1.write('L7', sheet1_L7)
            worksheet1.write('M4', sheet1_M4)
            worksheet1.write('M5', sheet1_M5)
            worksheet1.write('M6', sheet1_M6)
            worksheet1.write('M7', sheet1_M7)

            workbook.close()
            return sheet7_D13
